﻿@using Website.Models.Domain
@using Website.Models.Styling
@model Website.Models.ViewModels.LocationsView
@{
    this.ViewBag.Title = "Lokationer";
    this.Layout = "~/Views/_Shared/_Layout.cshtml";
}

<div class="float-right smallMarginBottom">
    <input type="button" onclick="@string.Format("location.href = '{0}';", this.Url.Action("CreateLocation"))" value="Opret ny" class="" />
</div>
<table class="tableView">
    <tr>
        @foreach (TableViewHeaderItem item in this.Model.TableHeader.Items)
        {
            <td>
                @Html.Partial("~/Views/_Shared/TableViewHeader.cshtml", item)
            </td>
        }
    </tr>

    @if (this.Model != null)
    {
        foreach (Location loc in this.Model.Locations)
        {
            <tr>
                <td>@loc.Name</td>
                <td>
                    @if (loc.Region != null)
                    {
                        @loc.Region.Name
                    }
                </td>
                <td>
                    @if (loc.Address != null)
                    {
                        @loc.Address.Zip
                    }

                </td>
                <td>
                    @if (loc.Address != null)
                    {
                        @loc.Address.City
                    }
                </td>
                <td>
                    @if (loc.Address != null)
                    {
                        @Html.Label(loc.Address.StreetName + " " + loc.Address.StreetNr)
                    }
                </td>
                <td>
                    @if (loc.Address != null)
                    {
                        @loc.Address.Att
                    }
                </td>
            </tr>
        }
    }
    <tr>
        @Html.Partial("~/Views/_Shared/PagingArrows.cshtml", new PagingArrows { Action = "Index", TotalAmountOfColumns = 6, CurrentSkip = this.Model.Skip, CurrentTake = this.Model.Take, CurrentTotalRowCount = this.Model.TotalLocations })
    </tr>
</table>